package com.js.lottery.domin.award.service.factory;

import com.js.lottery.domin.award.service.goods.IDistributionGoods;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author:Pine Jiang
 * @Date:2023/11/20 Constructor(构造方法) -> @Autowired/@Resource(依赖注入) -> @PostConstruct(注释的初始化方法)
 **/

@Component
public class DistributionGoodsFactory extends GoodsConfig {
    public IDistributionGoods getDistributionGoodsService(Integer awardType) {
        return goodsMap.get(awardType);
    }

/*
    // 这种方法，在每个goods类中有一个<type，描述>字段，最好就是加一个枚举即可实现。
    private IDistributionGoods[] processes;
    @Autowired
    public DistributionGoodsFactory(IDistributionGoods[] processes) {
        this.processes = processes;
    }

    @PostConstruct
    public void init() {
        for (IDistributionGoods process : processes) {
            goodsMap.put(process.getType(), process);
        }
    }

    public IDistributionGoods getIdentityProcess(Integer type) {
        if(type == null) {
            return null;
        }
        return goodsMap.get(type);
    }
*/

}
